﻿using System;
using System.Collections.Generic;

namespace VkApi
{
    public class VkNewsEntry
    {
        public VkNewsEntryType Type { get; set; }
        public long SourceId { get; set; } //положительный - новость юзера, отрицательный - новость группы
        public DateTime Date { get; set; } //дата публикации
        public long Id { get; set; }
        public string Text { get; set; }
        public int LikesCount { get; set; }
        public int CommentsCount { get; set; }
        public string Preview { get; set; }
        public string PreviewBig { get; set; }
        public string UserId { get; set; }
        public VkProfileBase Sender { get; set; }
        public bool IsGroupEntry { get { return SourceId < 0; } }
        public List<VkAttachment> Attachments { get; set; }

        public static VkNewsEntryType ParseType(string input)
        {
            VkNewsEntryType result;
            switch (input)
            {
                case "post":
                    result = VkNewsEntryType.Post;
                    break;
                case "photo":
                    result = VkNewsEntryType.Photo;
                    break;
                case "photo_tag":
                    result = VkNewsEntryType.PhotoTag;
                    break;
                case "friend":
                    result = VkNewsEntryType.Friend;
                    break;
                case "note":
                    result = VkNewsEntryType.Note;
                    break;
                default:
                    result = VkNewsEntryType.Post;
                    break;
            }

            return result;
        }
    }
}
